package com.wicket.okrframework.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrframework.biz.service.DivineDataService;
import com.wicket.okrframework.biz.service.dto.req.*;
import com.wicket.okrframework.biz.service.dto.res.*;
import com.wicket.okrframework.common.ro.OkrResult;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/base/divineData/")
public class DivineDataController {
    @Autowired
    DivineDataService divineDataService;

    /**
   * D查询可用管理部门（特殊方法）
   */
    @PostMapping("queryDeptCollectionRemoveExistingDataList")
    public OkrResult<QueryDeptCollectionRemoveExistingDataListRespDto> queryDeptCollectionRemoveExistingDataList(@RequestBody @Validated QueryDeptCollectionRemoveExistingDataListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryDeptCollectionRemoveExistingDataListRespDto retData = divineDataService.queryDeptCollectionRemoveExistingDataList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * Redis批量清空用户信息
   */
    @PostMapping("batchClearUserInfoFromRedis")
    public OkrResult<BatchClearUserInfoFromRedisRespDto> batchClearUserInfoFromRedis(@RequestBody @Validated BatchClearUserInfoFromRedisReqDto reqDTO){
    return OkrResult.success(divineDataService.batchClearUserInfoFromRedis(reqDTO));
    }

    /**
   * D-Redis清空用户信息
   */
    @PostMapping("clearUserInfoFromRedis")
    public OkrResult<ClearUserInfoFromRedisRespDto> clearUserInfoFromRedis(@RequestBody @Validated ClearUserInfoFromRedisReqDto reqDTO){
    return OkrResult.success(divineDataService.clearUserInfoFromRedis(reqDTO));
    }

    /**
   * D-Redis清空用户Token(公共)
   */
    @PostMapping("clearTokenFromRedis")
    public OkrResult<ClearTokenFromRedisRespDto> clearTokenFromRedis(@RequestBody @Validated ClearTokenFromRedisReqDto reqDTO){
    return OkrResult.success(divineDataService.clearTokenFromRedis(reqDTO));
    }

    /**
   * D-Redis批量清空用户Token
   */
    @PostMapping("batchClearTokenFromRedis")
    public OkrResult<BatchClearTokenFromRedisRespDto> batchClearTokenFromRedis(@RequestBody @Validated BatchClearTokenFromRedisReqDto reqDTO){
    return OkrResult.success(divineDataService.batchClearTokenFromRedis(reqDTO));
    }

    /**
   * D-Redis获取用户就职信息
   */
    @PostMapping("addGetUserIrInfoFromRedis")
    public OkrResult<AddGetUserIrInfoFromRedisRespDto> addGetUserIrInfoFromRedis(@RequestBody @Validated AddGetUserIrInfoFromRedisReqDto reqDTO){
    return OkrResult.success(divineDataService.addGetUserIrInfoFromRedis(reqDTO));
    }

    /**
   * D-Redis获取用户基本信息
   */
    @PostMapping("getUserBasicInfoFromRedis")
    public OkrResult<GetUserBasicInfoFromRedisRespDto> getUserBasicInfoFromRedis(@RequestBody @Validated GetUserBasicInfoFromRedisReqDto reqDTO){
    return OkrResult.success(divineDataService.getUserBasicInfoFromRedis(reqDTO));
    }

    /**
   * Redis获取空间信息
   */
    @PostMapping("getSpaceInfoFromRedis")
    public OkrResult<GetSpaceInfoFromRedisRespDto> getSpaceInfoFromRedis(@RequestBody @Validated GetSpaceInfoFromRedisReqDto reqDTO){
    return OkrResult.success(divineDataService.getSpaceInfoFromRedis(reqDTO));
    }

    /**
   * Redis切换公共信息（后端）
   */
    @PostMapping("changePublicInfoFromRedis")
    public OkrResult<ChangePublicInfoFromRedisRespDto> changePublicInfoFromRedis(@RequestBody @Validated ChangePublicInfoFromRedisReqDto reqDTO){
    return OkrResult.success(divineDataService.changePublicInfoFromRedis(reqDTO));
    }

    /**
   * 异步结束
   */
    @PostMapping("asynchronizationEnd")
    public OkrResult<AsynchronizationEndRespDto> asynchronizationEnd(@RequestBody @Validated AsynchronizationEndReqDto reqDTO){
    return OkrResult.success(divineDataService.asynchronizationEnd(reqDTO));
    }

    /**
   * 异步开始
   */
    @PostMapping("asynchronizationStart")
    public OkrResult<AsynchronizationStartRespDto> asynchronizationStart(@RequestBody @Validated AsynchronizationStartReqDto reqDTO){
    return OkrResult.success(divineDataService.asynchronizationStart(reqDTO));
    }

    /**
   * D查询过滤后可推荐业务场景列表
   */
    @PostMapping("queryHostTypeCollectionRemoveExistingDataList")
    public OkrResult<QueryHostTypeCollectionRemoveExistingDataListRespDto> queryHostTypeCollectionRemoveExistingDataList(@RequestBody @Validated QueryHostTypeCollectionRemoveExistingDataListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryHostTypeCollectionRemoveExistingDataListRespDto retData = divineDataService.queryHostTypeCollectionRemoveExistingDataList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D检查集合去除已存在数据
   */
    @PostMapping("checkCollectionRemoveExistingData")
    public OkrResult<CheckCollectionRemoveExistingDataRespDto> checkCollectionRemoveExistingData(@RequestBody @Validated CheckCollectionRemoveExistingDataReqDto reqDTO){
    return OkrResult.success(divineDataService.checkCollectionRemoveExistingData(reqDTO));
    }

    /**
   * D授权角色/权限去除已存在
   */
    @PostMapping("addCollectionRemoveExistingData")
    public OkrResult<AddCollectionRemoveExistingDataRespDto> addCollectionRemoveExistingData(@RequestBody @Validated AddCollectionRemoveExistingDataReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        AddCollectionRemoveExistingDataRespDto retData = divineDataService.addCollectionRemoveExistingData(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D-公共信息存储Redis
   */
    @PostMapping("putPublicInfoToRedis")
    public OkrResult<PutPublicInfoToRedisRespDto> putPublicInfoToRedis(@RequestBody @Validated PutPublicInfoToRedisReqDto reqDTO){
    return OkrResult.success(divineDataService.putPublicInfoToRedis(reqDTO));
    }
/**
   * D1-推送公共字段缓存(公共)
   */
    @PostMapping("putPublicFieldCacheCom")
    public OkrResult<PutPublicFieldCacheComRespDto> putPublicFieldCacheCom(@RequestBody @Validated PutPublicFieldCacheComReqDto reqDTO){
    return OkrResult.success(divineDataService.putPublicFieldCacheCom(reqDTO));
    }
/**
   * D1-集合去除已存在员工就职记录数据(公共)
   */
    @PostMapping("addCollectionRemoveExistingDataCom")
    public OkrResult<AddCollectionRemoveExistingDataComRespDto> addCollectionRemoveExistingDataCom(@RequestBody @Validated AddCollectionRemoveExistingDataComReqDto reqDTO){
    return OkrResult.success(divineDataService.addCollectionRemoveExistingDataCom(reqDTO));
    }
/**
   * D1执行接收字段(公共)
   */
    @PostMapping("implementReceiveFieldCom")
    public OkrResult<ImplementReceiveFieldComRespDto> implementReceiveFieldCom(@RequestBody @Validated ImplementReceiveFieldComReqDto reqDTO){
    return OkrResult.success(divineDataService.implementReceiveFieldCom(reqDTO));
    }
/**
   * D1集合去除已存在的部门数据(公共)
   */
    @PostMapping("queryCollectionRemoveDeptExistingDataListCom")
    public OkrResult<QueryCollectionRemoveDeptExistingDataListComRespDto> queryCollectionRemoveDeptExistingDataListCom(@RequestBody @Validated QueryCollectionRemoveDeptExistingDataListComReqDto reqDTO){
    return OkrResult.success(divineDataService.queryCollectionRemoveDeptExistingDataListCom(reqDTO));
    }
}
  